﻿using System.Collections;
using System.Linq;
using CardPlay.DemoPack;
using CardPlay.Model;
using CardPlay.Model.GameModel;
using NUnit.Framework;

namespace CardPlay.Tests.DemoPack
{
    [TestFixture]
    public class DemoGameTests
    {
        [TestCaseSource("TestCasesForNewGame")]
        public void NewGame_ShouldBeInNotStartedState_AfterInitialDeal(IGameDescriptor gameDescriptor)
        {
            var game = gameDescriptor.CreateInstance();
            game.Deal(new MockRandomNumberSequence { Seed = 12234 });

            Assert.AreEqual(StateOfPlay.NotStarted, game.StateOfPlay);
        }

        public static IEnumerable TestCasesForNewGame
        {
            get
            {
                IGamePackage pack = new GamePackage();
                return pack.Games.Select(descriptor => new TestCaseData(descriptor).SetDescription(descriptor.DisplayName));
            }
        }
    }
}
